//
//  TWVideoCollectionOfAuthorWithCoverModel.swift
//  EyepetizerImitative
//
//  Created by 田伟 on 2017/3/30.
//  Copyright © 2017年 个人. All rights reserved.
//  videoCollectionWithBrief这个cell也是共用当前model

import UIKit

class TWVideoCollectionOfAuthorWithCoverModel: NSObject {
    // MARK:- 属性
    var count : NSNumber?                                                                       // 个数
    var dataType : String?                                                                      // 类型
    var header : VideoCollectionOfAuthorWithCoverHeaderModel?
    var itemList : [[String : AnyObject]]?{
        didSet {
            for item in itemList! {
                let itemModel = TWItemModel(dict: item["data"] as! [String : AnyObject])
                itemList_tw.append(itemModel)
            }
        }
    }
    
    // MARK:- 自定义属性
    var itemList_tw = [TWItemModel]()
    
    // MARK:- 转成字典——自定义构造函数
    init(dict : [String : AnyObject]) {
        super.init()
        setValuesForKeys(dict)
        
        // 转封面字典
        if let dict = dict["header"] as? [String : AnyObject] {
            header = VideoCollectionOfAuthorWithCoverHeaderModel(dict: dict)
        }
    }
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
}

class VideoCollectionOfAuthorWithCoverHeaderModel: NSObject {
    
    // MARK:- 属性
    var actionUrl : String?                                                                      // 点击进入的网址
    var cover : String?                                                                          // 封面
    var tw_description : String?                                                                 // 详情描述
    var font : String?                                                                           // 字体
    var id : NSNumber?                                                                           // ID
    var title : String?                                                                          // 标题
    var follow : FollowModel?
    var icon : String?
    
    // MARK:- 转成字典——自定义构造函数
    init(dict : [String : AnyObject]) {
        super.init()
        tw_description = dict["description"] as! String?
        setValuesForKeys(dict)
        
        if let dict = dict["follow"] as? [String : AnyObject] {
            follow = FollowModel(dict: dict)
        }
    }
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
}

class FollowModel: NSObject {
    var itemId : NSNumber?
    var itemType :  String?
    init(dict : [String : AnyObject]) {
        super.init()
        setValuesForKeys(dict)
    }
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
}

